import React from 'react';
import { inject, observer } from 'mobx-react';
import { Spin, Checkbox } from 'antd'
import { WeaRightMenu, WeaLocaleProvider,WeaDialog } from 'ecCom';
import { WeaTableNew } from "comsMobx";

const WeaTable = WeaTableNew.WeaTable;
const getLabel = WeaLocaleProvider.getLabel;


/**
 * 考核设置-考核指标项
 * jiansong 2019/6/18
 */
@inject("blogContentExportStore")
@observer
export default class ExportList extends React.Component {

    constructor(props) {
        super(props);
        this.state = {
            title: '', 
        }
        this.store = this.props.blogContentExportStore;
    }

    componentDidMount() {
        const { blogContentExportStore,submitStatus } = this.props;
        let params;
        if(!blogContentExportStore.radioGroupParams.submitStatus){
            params ={timeRange:'1',userRange:'1',submitStatus:'1'}
            blogContentExportStore.getTableDatas(params);
        }
      }
    render() {
        let _this=this;
        const { loading, tableStore,submitStatus } = _this.store;
        return (
            <Spin ecId={`${this && this.props && this.props.ecId || ''}_Spin@gy6k06`} spinning={loading}>
                <div>
                <WeaTable ecId={`${this && this.props && this.props.ecId || ''}_WeaTable@xpageh`}
                    comsWeaTableStore={tableStore}
                    needScroll
                    getColumns={this.getColumns}
                />
                </div>
            </Spin>
        )
    }





    getColumns = columns => {
        const { setExportLogDetailIsShow } = this.store;
        return columns.map(col => {
            if (col.dataIndex == "createdate") {
                col.render = (text, data) =>{
                    let createTime = data.createtimespan;
                    if(createTime){
                        createTime=createTime.substring(0,createTime.lastIndexOf(":"));
                    }
                   return data.createdatespan+' '+ createTime
             }
            } 
            return col;
        });
    }
}